package com.sams.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import com.github.pagehelper.PageInfo;
import com.sams.entity.SubsidizeManager;
import com.sams.mapper.SubsidizeManagerMapper;
import com.sams.service.SubsidizeManagerService;

@RequestMapping("/subsidize")
@Controller
public class SubsidizeManagerController {
	@Autowired
	private SubsidizeManagerService service;
	
	//分页查询
		@RequestMapping("/list")
		public String listSubsidizeManager(Integer currentPage,Model model) {
			if(currentPage==null || currentPage ==0) {
				currentPage=1;
			}
			PageInfo<SubsidizeManager> pageInfo= service.listSubsidize(currentPage);
			model.addAttribute("pageInfo",pageInfo);
			return "subsidize";
		}
		
		
		//删除领导信息
		@RequestMapping("/delete/{id}")
		public String delete(@PathVariable("id") Integer id) {
			service.delete(id);
			return "forward:/subsidize/list";
		}
		
		//添加领导信息
		@RequestMapping("/add")
		public String add(SubsidizeManager sub) {
			service.add(sub);
			return "forward:/subsidize/list";
		}
		
		//修改领导信息
		@RequestMapping("/update")
		public String update(SubsidizeManager sub) {
			service.update(sub);
			return "forward:/subsidize/list";
		}

}
